package com.sctvcloud.bazhong.ui.adapter.holder;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ruihang.ijkplaylib.widget.IjkVideoView;
import com.sctvcloud.bazhong.R;
import com.sctvcloud.bazhong.beans.LiveFocusItem;
import com.sctvcloud.bazhong.beans.NewsItem;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by yuxipan on 2017-07-04.
 */

public class LiveFocusHolder extends BaseAbsHolder<NewsItem> {
    @BindView(R.id.video_view)
    protected IjkVideoView videoView;
    //    @ViewInject(R.id.iv_item_live_pic)
    protected ImageView ivPic;
    @BindView(R.id.iv_play)
    protected ImageView ivPlayer;
    @BindView(R.id.tv_live_status)
    protected TextView tvStatus;
    @BindView(R.id.tv_live_loop_title)
    protected TextView tvTitle;
    //    @BindView(R.id.ll_main_live)
    protected LinearLayout llList;
    @BindView(R.id.ll_live_container)
    protected LinearLayout llContainer;

    //    @BindView(R.id.rl_liv_item1)
    private View vItem1;
    //    @BindView(R.id.rl_liv_item2)
    private View vItem2;
    //    @BindView(R.id.rl_liv_item3)
    private View vItem3;

    public LiveFocusHolder(Context context, View itemView) {
        super(context, itemView);

    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(NewsItem liveFocusItem) {
        if (liveFocusItem == null) {
            return;
        }
        if (liveFocusItem.getLives().size() == 1) {
            llContainer.setVisibility(View.GONE);
        } else if (liveFocusItem.getLives().size() == 2) {
            llContainer.setVisibility(View.VISIBLE);
            vItem1.setVisibility(View.VISIBLE);
            vItem2.setVisibility(View.VISIBLE);
            vItem3.setVisibility(View.INVISIBLE);


        } else if (liveFocusItem.getLives().size() == 3) {
            llContainer.setVisibility(View.VISIBLE);
            vItem1.setVisibility(View.VISIBLE);
            vItem2.setVisibility(View.VISIBLE);
            vItem3.setVisibility(View.VISIBLE);
        }

    }

    private void setViewDate(View itemView, LiveFocusItem item) {

    }


}
